using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using XinBang.ShoppingCart;

namespace XinBang.Web
{
    public class Global : System.Web.HttpApplication
    {

        protected void Application_Start(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }

        protected void Session_Start(object sender, EventArgs e)
        {
            if(Session["shoppingcart"]==null){
                Session["shoppingcart"] = new Cart();
            }
        }

        protected void Session_End(object sender, EventArgs e)
        {
            if (Session["shoppingcart"] != null)
            {
                Cart sc = (Cart)Session["shoppingcart"];
                sc.ClearShoppingCart();
                Session.Remove("shoppingcart");
            }
        }
    }
}